package com.example.demo.controller;

import com.example.demo.entity.Product;
import com.example.demo.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Created by Administrator on 2017/6/16.
 */
@RestController
@RequestMapping("/p")
public class ProductController {

    @Autowired
    private IProductService productService;


    @RequestMapping("/add")
    public Object add(){
        Product product = new Product();
        product.setPname("鼠标");
        product.setTypeId(1);
        product.setInDate(new Date());
        return productService.insert(product);
    }
}
